{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import os\n",
    "import json\n",
    "df = pd.read_excel('data.xlsx')\n",
    "with open(\"data.json\",'w') as f:\n",
    "    j = json.loads(df.to_json(orient=\"records\",force_ascii=True))\n",
    "    for d in j:\n",
    "        if os.path.isfile(f\"img/avatar/{d['id']}.jpg\"):\n",
    "            d['ava']=f\"img/avatar/{d['id']}.jpg\"\n",
    "        if os.path.isfile(f\"img/avatar/{d['id']}c.jpg\"):\n",
    "            d['avac']=f\"img/avatar/{d['id']}c.jpg\"\n",
    "    json.dump(j,f)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "starEnv",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.13"
  },
  "orig_nbformat": 4
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
